
/*---------------------------------------------------------------------------*/
/*                             BLAZE-DEM V1.0
 -----------------------------------------------------------------------------

 * --------------------------
 *     Complete Features
 * --------------------------
 *       1. INPUT (KSimulationData.h)
   * World Input FileIO
   * World    Object Input FileIO
   * Particle Object Input FileIO
   --------------------------
         2. Data Structures
   * Simulation Information: Host/Device (KSimulationObjects.h)
   --------------------------
         3. Graphics
   * (Main.cpp) and (Graphics.h)
   * Only the Position and Rotation is required
   --------------------------
         4. Host/Device
   * Communication Via Class: KInterface
 */

/* Author: Nicolin Govender
 * Revision 1: 22/9/2012
 * Revision 2: 30/10/2012
 * Revision 3: 4/11/2012 : Added Grid Hashing
 * Revision 4: 1/1/2013  : NNGrid Via KInput
 * Revision 4: 2/6/2013  : Clean up for Release
 * */

/* Feature List


/*---------------------------------------------------------------------------*/
                    /* REQUIRED INCLUDE FILES*/
/*---------------------------------------------------------------------------*/
                     /* System C++ */
#include <iostream>
#include <stdlib.h>

                      /* Vector types */
#include <vector_types.h>
#include "../../Helpers/inc/helper_math.h"


                      /* Project Includes */
#include "Input/KSimulationData.h"

#include "Interface/KDevice.h"



/*---------------------------------------------------------------------------*/
                     /* Pointers to Classes*/
/*---------------------------------------------------------------------------*/

KSimulationData *m_KSimulationData;  /* Input Data*/
KDevice         *m_KDevice;          /* Device methods */
/*---------------------------------------------------------------------------*/

/*---------------------------------------------------------------------------*/
                     /* Data Storage Objects */
/*---------------------------------------------------------------------------*/
SimulationInfo   SimInfo;
WOBJ            *m_KWorldObject;
POBJ            *m_KParticleObject;
InitConfig       m_InitPos;

int              m_num_KWorldObjects;
int              m_num_KParticleObjects;
/*---------------------------------------------------------------------------*/



                   /* Local Variables */
int   num_timeStep  = 499;
int   frame         = 0;
float t             = 0.0f;
bool  m_ColorLevels = false;
char  fps[256];
int    m_Particle_Type [2097152]; /* Local Host */
float3 m_colorP        [2097152]; /* Local Host */
/*--------------------------------------------------------------------------------*/

Quaterion quart_axisAngleH(Quaterion Q1)
{
	Quaterion q;
	float angle = (2.0f*acos(Q1.w));
	float coeff=0.0f;
	if(angle>0.0f)
	{
	 coeff = 1.0f/sin(angle*0.5f);
	}
	 q.w = angle*(180.0f/(2.0f*asin(1.0)));
	q.x = Q1.x*coeff;
	q.y = Q1.y*coeff;
	q.z = Q1.z*coeff;


	return q;
}

